$(function() {
    //节流阀
    var flag = false;
    function loadPointData() {
        if(flag) return false;
        $.ajax({
            type: "get",
            url: domain.test + "/getpoint",
            // url: domain.online + "/api/custom", 
            dataType: "json",
            beforeSend: function () {
                flag = true;
            },
            success: function (response) {
                if(response.data.rtnCode===200) {
                // if(response.rtnCode===200) {
                    var pointDetail = response.data.data;
                    // var pointDetail = response.data;
                    $(".contentBox").html(template("contentBox",{pointDetail:pointDetail}));
                    pullmaster.pullDownSuccess();
                    flag = false;
                }
            }
        });
    }
    loadPointData();
    var pullmaster = new Pull($('.contentBox'), {
        onPullDown: function () {
            loadPointData();
        }
    });
    //host详情
    $(".contentBox").on("click",".productItem",function(){
        var pId = $(this).attr("data-id");
        console.log(pId);
        location.href = "../classify/product.html?id=" + pId;
    });
    //custom详情
    $(".contentBox").on("click",".customItem",function(){
        var pId = $(this).attr("data-id");
        console.log(pId);
        location.href = "../classify/product.html?id=" + pId;
    });
});